package com.ycd.block;

import com.alibaba.csp.sentinel.slots.block.BlockException;
import com.ycd.domain.User;
import org.springframework.web.bind.annotation.PathVariable;

/**
 * 创建降级类、静态降级方法
 */
public class UserBlock {

    // 这里测试其它类进行服务降级
    public static User degradationMethod(@PathVariable("id") Long id, BlockException e){
        e.printStackTrace();
        return new User(-1L, "指定类限流服务降级触发！！", "当前服务流量过大，请稍后重试！");
    }
}
